package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        /*
        简易倒计时程序
         */
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个数字");
        for (int num=sc.nextInt();num>0;num--) {
            System.out.println("剩余"+num+"秒");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        sc.close();
        System.out.println("程序结束了");
    }
}
